package com.ruoyi.cms.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.cms.mapper.CmsBannerItemMapper;
import com.ruoyi.cms.domain.CmsBannerItem;
import com.ruoyi.cms.service.ICmsBannerItemService;

/**
 * 广告Service业务层处理
 * 
 * @author he
 * @date 2025-06-23
 */
@Service
public class CmsBannerItemServiceImpl implements ICmsBannerItemService 
{
    @Autowired
    private CmsBannerItemMapper cmsBannerItemMapper;

    /**
     * 查询广告
     * 
     * @param id 广告主键
     * @return 广告
     */
    @Override
    public CmsBannerItem selectCmsBannerItemById(Long id)
    {
        return cmsBannerItemMapper.selectCmsBannerItemById(id);
    }

    /**
     * 查询广告列表
     * 
     * @param cmsBannerItem 广告
     * @return 广告
     */
    @Override
    public List<CmsBannerItem> selectCmsBannerItemList(CmsBannerItem cmsBannerItem)
    {
        return cmsBannerItemMapper.selectCmsBannerItemList(cmsBannerItem);
    }

    /**
     * 新增广告
     * 
     * @param cmsBannerItem 广告
     * @return 结果
     */
    @Override
    public int insertCmsBannerItem(CmsBannerItem cmsBannerItem)
    {
        cmsBannerItem.setCreateTime(DateUtils.getNowDate());
        return cmsBannerItemMapper.insertCmsBannerItem(cmsBannerItem);
    }

    /**
     * 修改广告
     * 
     * @param cmsBannerItem 广告
     * @return 结果
     */
    @Override
    public int updateCmsBannerItem(CmsBannerItem cmsBannerItem)
    {
        return cmsBannerItemMapper.updateCmsBannerItem(cmsBannerItem);
    }

    /**
     * 批量删除广告
     * 
     * @param ids 需要删除的广告主键
     * @return 结果
     */
    @Override
    public int deleteCmsBannerItemByIds(Long[] ids)
    {
        return cmsBannerItemMapper.deleteCmsBannerItemByIds(ids);
    }

    /**
     * 删除广告信息
     * 
     * @param id 广告主键
     * @return 结果
     */
    @Override
    public int deleteCmsBannerItemById(Long id)
    {
        return cmsBannerItemMapper.deleteCmsBannerItemById(id);
    }
}
